package cn.org.timespace.easyframe.service.permission.impl;

import java.util.List;

import cn.org.timespace.easyframe.action.permission.EFMenuModel;
import cn.org.timespace.easyframe.dao.permission.EfMenuDao;
import cn.org.timespace.easyframe.model.permission.EfMenu;
import cn.org.timespace.easyframe.service.permission.EfMenuService;
import cn.org.timespace.easyframe.util.generator.IdentityGenerator;

public class EfMenuServiceImpl implements EfMenuService {

	private EfMenuDao efMenuDao;

	public EfMenuDao getEfMenuDao() {
		return efMenuDao;
	}

	public void setEfMenuDao(EfMenuDao efMenuDao) {
		this.efMenuDao = efMenuDao;
	} 

	public void delete(EfMenu persistentInstance) {
		efMenuDao.delete(persistentInstance);
	}

	public void save(EfMenu transientInstance) {
		transientInstance.setMenuId(IdentityGenerator.getInstance().getId());
		efMenuDao.save(transientInstance);

	}

	public List<EfMenu> findByCondition(EFMenuModel model){
		return efMenuDao.findByCondition(model);
	}

	public List<EfMenu> findSecondLevelMenu() {
		return efMenuDao.findSecondLevelMenu();
	}

	public List<EfMenu> findTopLevelMenu() {
		return efMenuDao.findTopLevelMenu();
	}

	public void update(EfMenu instance){
		efMenuDao.update(instance);
	}

	public List<EfMenu> findSecondLevelMenu(String userId, String modelId) {
		return efMenuDao.findSecondLevelMenu(userId, modelId);
	}

	public List<EfMenu> findThirdLevelMenu(String userId, String modelId) {
		return efMenuDao.findThirdLevelMenu(userId, modelId);
	}

	public List<EfMenu> findTopLevelMenu(String userId) {
		return efMenuDao.findTopLevelMenu(userId);
	}
	
}